package com.shiyi.shiyiaiagent.rag;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.document.Document;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.transformer.KeywordMetadataEnricher;
import org.springframework.ai.vectorstore.SimpleVectorStore;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * AI原信息增强器（为文档补充原信息）
 */
@Component
public class MyKeywordEnricher {

  @Resource
  private ChatModel dashscopeChatModel;

  public List<Document> enrichDocument(List<Document> documents) {
    KeywordMetadataEnricher keywordMetadataEnricher = new KeywordMetadataEnricher(dashscopeChatModel, 5);
    return keywordMetadataEnricher.apply(documents);
  }
}
